var ComFuncEpdParaBt = function () {
    function formatter(value, row, index) {
        var ret = "";
        switch (value.type) {
            case "Null":
                ret = value.value;
                break;
            default:
                ret = value;
        }
        return ret;
    }

    function cellStyle(value, row, index) {
        var ret = {};
        switch (value.type) {
            // case "Dprop":
            //     ret = { classes: "warning" };
            //     break;
            // case "Bprop":
            //     ret = { classes: "info" };
            //     break;
            case "Null":
                break;
            default:
                ret = {};
        }
        return ret;
    }

    return {
        bindTable: function (tableId, option) {
            //单元格格式
            option.columns.forEach(col => {
                col.formatter = formatter;
                // col.cellStyle = cellStyle;
            });
            //否显示行间隔色
            option.search = true;
            option.striped = true;
            option.showHeader = true;
            option.showRefresh = false;
            option.showToggle = true;
            option.showPaginationSwitch = true;
            //分页
            option.pagination = true;
            // option.pageSize = 20;

            return ComFuncBt.bindTable(tableId, option);
        }


    };

}();
var ComFuncEpdPlBt = function () {
    function formatter(value, row, index) {
        var ret = "";
        switch (value.type) {
            case "Bprop":
                ret = value.value;
                break;
            case "Dprop":
                ret = value.value;
                break;
            case "Null":
                ret = '';
                break;
            default:
                ret = value;
        }
        return ret;
    }

    function cellStyle(value, row, index) {
        var ret = {};
        switch (value.type) {
            case "Dprop":
                ret = { classes: "warning" };
                break;
            case "Bprop":
                ret = { classes: "info" };
                break;
            case "Null":
                break;
            default:
                ret = {};
        }
        return ret;
    }

    return {
        bindTable: function (tableId, option) {
            //单元格格式
            option.columns.forEach(col => {
                col.formatter = formatter;
                col.cellStyle = cellStyle;
            });
            //否显示行间隔色
            option.search = false;
            option.striped = false;
            option.showHeader = true;
            option.showRefresh = false;
            option.showToggle = false;
            option.showPaginationSwitch = false;
            //分页
            option.pagination = false;
            // option.pageSize = 20;

            return ComFuncBt.bindTable(tableId, option);
        }


    };

}();
var ComFuncEpdBt = function () {
    var optiontemp;
    function paraNameClick(para){
        if (optiontemp.paraNameClick) {
            optiontemp.paraNameClick(para);
        }
    }

    function formatter(value, row, index) {
        var ret = "";
        switch (value.type) {
            case "Remark":
                ret = value.value;
                break;
            case "Para":
                if (value.para) {
                    ret =
                        "<a href=\"javascript:;\" class=\"tooltips\" onClick=\"paraNameClick('" + value.value+"')\" " +
                        "data-original-title=\"" + value.para.desc_cn + "," + value.para.desc_en + 
                    "\" > " + value.value + " </a> ," + value.para.desc_cn;

                } else {
                    ret = value.value;
                }

                break;
            case "PN":
                ret = value.value;
                break;
            case "Null":
                ret = '';
                break;
            case "PNRet":
                ret = value.value;
                break;
            case "PNElse":
                ret = '';
                break;
            case "Value":
                ret = value.value;
                break;
            case "VElse":
                ret = value.value;
                break;
            default:
                ret = value;
        }
        return ret;
    }

    function cellStyle(value, row, index) {
        var ret = {};
        switch (value.type) {
            case "Remark":
                // ret = { classes: "bg-grey-cascade bg-font-grey-cascade" };
                // ret = { css: { "background-color": "red" } };
                break;
            case "Para":
                ret = { classes: "warning" };
                // ret = { classes: "bg-green-jungle" };
                break;
            case "PN":
                ret = { classes: "info" };
                break;
            case "Null":
                break;
            case "PNRet":
                ret = { classes: "danger" };
                break;
            case "PNElse":
                ret = { classes: "active" };
                break;
            case "Value":
                ret = { classes: "success" };
                // ret = { classes: "bg-green-meadow" };
                break;
            case "VElse":
                ret = { classes: "active" };
                break;
            default:
                ret = {};
        }
        return ret;
    }

    return {
        bindTable: function (tableId, option) {
            optiontemp = option;
            //单元格格式
            option.columns.forEach(col => {
                col.formatter = formatter;
                col.cellStyle = cellStyle;
            });
            //否显示行间隔色
            option.striped = false;
            option.showHeader = false;
            option.showRefresh = false;
            option.showToggle = false;
            //分页
            // option.pagination = false;
            // option.pageSize = 20;

            return ComFuncBt.bindTable(tableId, option);
        }


    };

}();
//Formula
var ComFuncEpdFormulaBt = function () {
    function formatter(value, row, index) {
        var ret = "";
        switch (value.type) {
            case "Remark":
                ret = value.value;
                break;
            case "Para":
                ret = value.value;
                break;
            case "NullPara":
                // ret = value.value;
                break;
            case "ParaName":
                ret = value.value;
                break;
            case "Null":
                ret = '';
                break;
            case "Ret":
                ret = value.value;
                break;
            case "NullRet":
                // ret = value.value;
                break;
            case "Value":
                ret = value.value;
                break;
            case "NullValue":
                // ret = value.value;
                break;
            default:
                ret = value;
        }
        return ret;
    }

    function cellStyle(value, row, index) {
        var ret = {};
        switch (value.type) {
            case "Remark":
                // ret = { classes: "warning" };
                break;
            case "Para":
                ret = { classes: "warning" };
                break;
            case "NullPara":
                ret = { classes: "warning" };
                break;
            case "ParaName":
                ret = { classes: "info" };
                break;
            case "Null":
                break;
            case "Ret":
                ret = { classes: "danger" };
                break;
            case "Value":
                ret = { classes: "success" };
                break;
            case "NullRet":
                ret = { classes: "active" };
                break;
            case "NullValue":
                ret = { classes: "success" };
                break;
            default:
                ret = {};
        }
        return ret;
    }

    return {
        bindTable: function (tableId, option) {
            //单元格格式
            option.columns.forEach(col => {
                col.formatter = formatter;
                col.cellStyle = cellStyle;
            });
            //否显示行间隔色
            option.search = false;
            option.strictSearch = false;
            option.striped = false;
            option.showHeader = true;
            option.showRefresh = false;
            option.showToggle = false;
            option.showPaginationSwitch = false;
            //分页
            option.pagination = false;
            // option.pageSize = 20;


            return ComFuncBt.bindTable(tableId, option);
        }


    };

}();
var ComFuncBt = function () {
    var tableOption = {
        url: '',         //请求后台的URL（*）
        method: 'get',                      //请求方式（*）
        contentType: 'application/json;charset=UTF-8',
        dataType: 'json',                      //服务器返回的数据类型*）
        // toolbar: '',                //工具按钮用哪个容器
        striped: true,                      //是否显示行间隔色
        cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
        sortable: false,                     //是否启用排序
        sortOrder: "asc",                   //排序方式
        // queryParams: oTableInit.queryParams,//传递参数（*）

        pagination: true,                   //是否显示分页（*）
        showPaginationSwitch: true,         //是否显示分页按钮
        sidePagination: "client",           //分页方式：client客户端分页，server服务端分页（*）
        paginationVAlign: "top",           //指定 分页条 在垂直方向的位置。’top’ or ‘bottom’ or ‘bonth’
        pageNumber: 1,                       //初始化加载第一页，默认第一页
        pageSize: 10,                       //每页的记录行数（*）
        // pageList: [10, 25, 50, 100,All],        //可供选择的每页的行数（*）


        search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
        strictSearch: true,
        showColumns: false,                  //是否显示所有的列
        showRefresh: false,                  //是否显示刷新按钮
        minimumCountColumns: 2,             //最少允许的列数
        clickToSelect: true,                //是否启用点击选中行

        // height: 500,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
        // uniqueId: "id",                     //每一行的唯一标识，一般为主键列
        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
        cardView: false,                    //是否显示详细视图
        detailView: false,                   //是否显示父子表
        columns: ''
    };

    return {
        bindTable: function (tableId, option) {
            var result = $.extend({}, tableOption, option);
            return $(tableId).bootstrapTable(result);
        }
    };

}();